Repository navigation
fix(canvas): honor the system clipboard - #698
Conversation
## summary - Route canvas shortcuts through browser clipboard events and use the current clipboard for menu paste. - Accept text, media files and supported HTML images while preserving editor focus and same-browser canvas fragments. - Reuse registered assets across projects and cover external clipboard replacement, cutting, menu paste and reopened results.
## summary - Let a stale file input event target defer to canvas focus while retaining protection for text editors and dialogs.
## summary - Capture the baseline and corrected paste path on an isolated project. - Record the browser clipboard workflow and the reopened destination.
## summary - Check the UTF-8 byte limit before creating a pasted text node. - Exercise oversized multibyte text in both browser locales.
## summary - Record the clipboard workflow after correcting UTF-8 size validation. - Show the oversized text rejection and the reopened destination.
david6666666
left a comment
There was a problem hiding this comment.
COMMENT(非表决) ed0044e Refs #689
技术意见:建议修改后复审。
当前证据暂定 82/100,非批准分(范围 3、正确性 2、验证 2、主张证据 3、简洁度 2)。我下载播放了 11.84 秒录像,核对了三张截图和资产 blob;录制的应用提交到当前 tip 只增加演示素材。旧节点不再盖过外部 clipboard、文本成节点、图片粘贴和大文本拒绝都有可见证据。没有独立运行应用或安装包。
还有一个并发顺序缺口:异步图片/跨项目素材尚未完成时,后粘贴的文本可以先写入;较早的素材之后落地反抢 selection,也改变 Undo 的顺序。我把建议留在入口。当前 Release 未全绿。
English: 82/100 provisional. The new clipboard evidence is viewable; mixed async/sync pastes can commit out of user order.
Dot,代表 @david6666666。非表决评审,先修复顺序并补对应回归。
| const snapshot = snapshotClipboard(event.clipboardData); | ||
| if (!snapshot.files.length && !snapshot.html && !snapshot.text.trim()) return; | ||
| event.preventDefault(); | ||
| void pasteContent(snapshot, pasteDestination()); |
There was a problem hiding this comment.
每次 paste 都立即启动独立任务。第一笔如果在等图片读取或跨项目素材注册,第二笔纯文本会先 commit;第一笔晚到又改 selection,Undo 也先撤掉旧操作。visit guard 只能防切项目,不能保序。建议在同一次项目打开期间串行提交并让失败释放队列,补一个「慢图片 → 紧接文本」的测试,核对节点提交、selection 和 Undo 顺序。
## summary - Extract clipboard markers and image sources from a parse5 data tree. - Keep clipboard HTML out of browser HTML setters and exercise the parser without a browser document.
## summary - Register the Ark availability module in the Python shard inventory. - Record the inventory failure observed on main and PR 698.
## summary - Refresh the browser artifacts with the data-tree clipboard parser.
david6666666
left a comment
There was a problem hiding this comment.
COMMENT(非表决) 14047d7 Refs #689
88/100(范围 3、正确性 2、验证 3、主张证据 3、简洁度 2)。新提交把 Clipboard HTML 改成数据解析,不再交给活跃 DOM;该 head 的 Release、CodeQL 和 DSH 均通过。我下载并解码了新版 11.88 秒录屏,文件和两张新截图都匹配当前 blob;录制的应用版本到 tip 只补证据。未独立运行程序。
技术上仍建议先修再合:上轮提到的提交顺序没变,剪贴板解析调整没有改到异步 paste 完成、selection 和 Undo 的顺序。已有意见不再另贴一遍。不是因为落后 main,也不是因为 CI。
English: 88/100. Exact-head CI and revised media are green; the async paste ordering finding remains.
Dot,代表 @david6666666。非表决评审。
Why
Copying outside OpenDirector after copying a canvas node could leave the canvas pasting the earlier node. The same paste path now handles ordinary clipboard content and canvas fragments.
What changed
Scope
Canvas clipboard behavior. No linked issue. Builds on #689. Native file export and cross-browser graph transfer are outside this change. A separate commit restores the Ark availability test to the required Python shard after the same inventory check failed on main.
Verification
npm test,npm run build,npm run check:i18n,npm run check:browser-locale, andnpm run check:browser-manifest.93bd25b08a53633c08a9d904b1043e8cf6c2de65. Head14047d75c5f4f885ca0e9668080d877dd3386c1a.Evidence
The before-and-after screenshots and cross-tab result and the playable recording use application commit
cd82ad1ae2294decdd3162806228922b2117bd86. The final commit adds only these artifacts.